import {createStore} from 'vuex'
import getters from './getters'

const files = import.meta.globEager('./modules/*.js')
let modules = Object.keys(files).reduce((modules, path) => {
      const moduleName = path.replace(/^\.\/modules\/(.*)\.\w+$/, '$1')
      modules[moduleName] = (files[path]?.default)
      return modules
    },
    {}
)

export default createStore({
  modules,
  getters
})